<script type="text/javascript">
    $(document).ready(function(){
        
        $("#type").change(function(){
           
            if ($("#type>option:selected").val() != "")
                    $("#cat").val($("#type>option:selected").text());
            else 
                    $("#cat").val("");
            
            var result = ''; 	
            var type_id = $("#type").val();
            var url = '<?php echo osc_ajax_plugin_url("cars_attributes/ajax.php") . "&typeId="; ?>' + type_id;
              
            if(type_id != '') {               	
                Loading();		
                $.ajax({
                    type: "POST",
                    url: url,
                    dataType: 'json',
                    success: function(data){
                        var length = data.length;
                        if(length > 0) {  
                            result += '<option value=""><?php echo  __('Model', 'twitter_bootstrap');  ?></option>';
                            for(key in data) {
                                result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>';
                            }
                            result += '<option value="-1"><?php _e("Others", 'cars_attributes'); ?></option>';
                            $("#make").css("display", "");
                            $("#make").parent().css("display", "");
                        } else {
                            result += '<option value=""><?php _e('No results', 'cars_attributes'); ?></option>';	
                             $("#make").css("display", "none");
                             $("#make").parent().css("display", "none");
                        }                       
                        $("#make").html(result);
                        HideLoading();
                    }
                 });
             } 			
        });
    }); 
    function checkSearch()
    {
      var typeVal = $("#type").val();
      var makeVal = $("#make").val();
      var regVal = $("#region_id").val();
      if(typeVal == "" && makeVal == "" && regVal == ""){ return false;}
      return true;        
    }
</script>
<!-- search bar -->
        <div style="float:left;width:210px;">
            <div id="numVehicles" >
                
                <h4><img alt="mercatrucks" width="20" src="<?php echo osc_current_web_theme_url('images/minitruck.png') ; ?>" />
                    <span style="margin-left:4px;"><?php echo osc_total_items() . " " . __('vehicles for sale', 'twitter_bootstrap') ;?> </span></h4>
            </div>
            
	   <div class="well-search" style="text-align:center;">
					
				<p style="color: #6A6A6A;font-weight:bold;font-size:13px;margin-top:10px;line-height:8px;"><?php _e('begin your search here', 'twitter_bootstrap') ; ?></p>
					
                    <form action="<?php echo osc_base_url(true) ; ?>" method="get" >
                        <input type="hidden" name="page" value="search" />
                        <input type="hidden" id="cat" name="sCategory" />
                        <fieldset>												
						<div id="ulSearch">
						
							<div class="liSearch">		
<!--                                                                <span class="label info"><?php //_e('Type', 'twitter_bootstrap') ; ?></span>-->
								<?php item_type_list();//chosen_select_standard_list(); ?>
							</div>	
							
							<div class="liSearch">
<!--                                                                <span class="label notice"><?php //_e('Model', 'twitter_bootstrap') ; ?></span>-->
								<?php item_model_list("") ; ?>
							</div>							
								
                                                        <div class="liSearch" style="margin-bottom:4px;">
<!--                                                                <span class="label warning"><?php //_e('Region', 'twitter_bootstrap') ; ?></span>-->
								<?php item_region_list() ; ?>
							</div>	
													
							
							<button type="submit" class="btn info" style="font-weight:bold; width:170px;left:50%;right:50%;margin-right: 10px;"><?php _e('Search', 'twitter_bootstrap') ; ?></button>
							
						</div>	
						
						
                            <!--<input class="xlarge" type="text" name="sPattern" value="">
                            <?php //chosen_select_standard() ; ?>
                            <?php //chosen_region_select() ; ?>
                            <button type="submit" class="btn"><?php _e('Search', 'twitter_bootstrap') ; ?></button>-->
                       
						</fieldset>
                    </form>
		</div>

               
        </div>
		
        <!--<div class="search-line"></div>-->
        <!-- search bar end -->